package com.hong.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by John on 2019/1/26.
 */
@WebServlet(name="indexServlet",urlPatterns = "/index")  //servlet3.0后可以使用此注解代替web.xml中的配置
public class IndexServlet extends HttpServlet {
    @Override
    public void init() throws ServletException {
        System.out.println("servlet-study IndexServlet init...");
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("hello world");
    }
}
